﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Model;

namespace GataBaseSys
{
    public partial class Register : System.Web.UI.Page
    {
        GataBaseBLL bll = new GataBaseBLL();
        UserBLL bllOne = new UserBLL();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            SignIn info = new SignIn { SignInName = this.txtUser.Text.Trim(), SignInPwd = this.txtPwd.Text.Trim() };
            if (bllOne.GetCheckUser(info))
            {
                Response.Write("<script>alert('该账号已经存在!')</script>");
            }
            else
            {
                if (this.txtUser.Text.Trim() == "" || this.txtPwd.Text.Trim() == "")
                {
                    Response.Write("<script>alert('不能为空!')</script>");
                }
                else
                {
                    if (bll.ADD(info))
                    {
                        Response.Write("注册成功，请前往完善身份信息");
                        info = bll.GetOneByID(info);
                        Session["UserInfo"] = info;
                        Response.Redirect("RegInFrm.aspx");
                    }
                }
            }


        }
    }
}